package ohos.arkui.component.navigation

import ohos.arkui.component.common.*
import ohos.arkui.component.util.*
import ohos.base.*
import ohos.ffi.*
import ohos.labels.APILevel
import std.collection.HashMap
import std.deriving.Derive

/**
 * Indicates the context of NavDestination.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public class NavDestinationContext {
/**
 * Path information of the navigation destination page.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var pathInfo: NavPathInfo

/**
 * Page stack where the current navigation destination page is located.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var pathStack: NavPathStack

/**
 * Unique ID of the current navigation destination page, which is automatically generated by the system
 * and is irrelevant to the universal attribute **id** of the component.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var navDestinationId: String
}

/**
 * Defines NavDestination Component.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public class NavDestination <: CommonMethodComponent<NavDestination> & NavDestinationAttribute {
/**
 * The construct function of NavDestination.
 *
 * @param { () -> Unit } [child] - The child component of NavDestination. The default value is {=>}.
 * @returns { NavDestination }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public init(child!: () -> Unit = {=>})

/**
 * Called when the navigation destination is about
 * to be unmounted (or when the transition animation, if any, is about to start).
 *
 * @param { ?() -> Bool } callback - Indicates callback when the backButton is pressed.
 * @returns { This }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func onBackPressed(callback: ?() -> Bool): This

/**
 * Called when the NavDestination component is about to build a child component
 *
 * @param { ?Callback<NavDestinationContext, Unit> } callback
 * - Indicates callback that invoked before sub-components of NavDestination are created.
 * @returns { This }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func onReady(callback: ?Callback<NavDestinationContext, Unit>): This

/**
 * Sets the page title. When the NavigationCustomTitle type is used to set the height,
 * the titleMode attribute does not take effect.
 * When the title string is too long: (1) If no subtitle is set, the string is scaled down,
 * wrapped in two lines, and then clipped with an ellipsis (...); (2) If a subtitle is set,
 * the subtitle is scaled down and then clipped with an ellipsis (...).
 *
 * @param { ?ResourceStr } value - Defines the title.
 * @param { ?NavigationTitleOptions } [options] - Indicates the options of titlebar.
 * @returns { This }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func title(value: ?ResourceStr, options!: ?NavigationTitleOptions = None): This

/**
 * Sets the page title. When the NavigationCustomTitle type is used to set the height,
 * the titleMode attribute does not take effect.
 * When the title string is too long: (1) If no subtitle is set, the string is scaled down,
 * wrapped in two lines, and then clipped with an ellipsis (...); (2) If a subtitle is set,
 * the subtitle is scaled down and then clipped with an ellipsis (...).
 *
 * @param { ?CustomBuilder } value - Defines the title.
 * @param { ?NavigationTitleOptions } [options] - Indicates the options of titlebar.
 * @returns { This }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func title(value: ?CustomBuilder, options!: ?NavigationTitleOptions = None): This

/**
 * Specifies whether to hide the title bar.
 *
 * @param { ?Bool } value - Default value: false . true : Hide the title bar. false : Show the title bar
 * @returns { This }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func hideTitleBar(value: ?Bool): This
}

/**
 * Indicates the information of the popped page.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public class PopInfo {
/**
 * The info of the popped page.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public let info: NavPathInfo

/**
 * The result of the popped page.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public let result: String
}

/**
 * Indicates the options of Navigation's Titlebar.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public class NavigationTitleOptions {
/**
 * Background color of the title bar. If this parameter is not set, the default color is used.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var backgroundColor: ?ResourceColor

/**
 * Background blur style of the title bar. If this parameter is not set, the background
 * blur effect is disabled.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var backgroundBlurStyle: ?BlurStyle

/**
 * Layout style of the title bar.
 * @default BarStyle.Standard
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var barStyle: ?BarStyle

/**
 * Set title bar start padding.
 * @default @r(sys.float.margin_left)
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var paddingStart: ?Length

/**
 * Set title bar end padding.
 * @default @r(sys.float.margin_right)
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var paddingEnd: ?Length

/**
 * Constructor of NavigationTitleOptions
 * @param { ?ResourceColor } [backgroundColor] - Background color of the title bar.
 * @param { ?BlurStyle } [backgroundBlurStyle] - Background blur style of the title bar.
 * @param { ?BarStyle } [barStyle] - Layout style of the title bar.
 * @param { ?Length } [paddingStart] - Set title bar start padding.
 * @param { ?Length } [paddingEnd] - Set title bar end padding.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public init(
        backgroundColor!: ?ResourceColor = None,
        backgroundBlurStyle!: ?BlurStyle = None,
        barStyle!: ?BarStyle = None,
        paddingStart!: ?Length = None,
        paddingEnd!: ?Length = None
    )
}

/**
 * Defines the mode of stack operation.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public enum LaunchMode {
/**
 * Default navigation stack operation mode.In this mode,
 * push operations add the specified **NavDestination**page to
 * the stack; replace operations replace the current top **NavDestination** page.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    Standard
    | 
/**
 * When the NavDestination with a specified name exists, it will be moved to top of stack,
 * otherwise, the behavior will be consistent with the STANDARD mode.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    MoveToTopSingleTon
    | 
/**
 * When the NavDestination with a specified name exists, the stack will pop until that NavDestination,
 * otherwise, the behavior will be consistent with the STANDARD mode.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    PopToSingleTon
    | 
/**
 * This mode creates an instance of **NavDestination**. Compared with
 * **STANDARD**, this mode does not reuse the instance with the same name in the stack.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    NewInstance
    | ...
}

extend LaunchMode <: Equatable<LaunchMode> {
/**
 * Compares this LaunchMode with another for equality.
 * @param { LaunchMode } other - The LaunchMode to compare with.
 * @returns { Bool } True if both modes are equal, false otherwise.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public operator func ==(other: LaunchMode): Bool
/**
 * Compares this LaunchMode with another for equality.
 * @param { LaunchMode } other - The LaunchMode to compare with.
 * @returns { Bool } True if both modes are not equal, false otherwise.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public operator func !=(other: LaunchMode): Bool
}

/**
 * Indicates the options of stack operation.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public class NavigationOptions {
/**
 * Navigation stack operation mode.
 * Default value: **LaunchMode.STANDARD**.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var launchMode: ?LaunchMode

/**
 * Whether to support transition animation.
 * Default value: **true**.
 * true: The transition animation is supported.
 * false: The transition animation is not supported.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var animated: ?Bool

/**
 * Constructor of NavigationOptions.
 *
 * @param { ?LaunchMode } [launchMode] - Navigation stack operation mode.
 * @param { ?Bool } [animated] - Whether to support transition animation.
 * @returns { NavigationOptions }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public init(launchMode!: ?LaunchMode = None, animated!: ?Bool = None)
}

/**
 * Declare BarStyle enum.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public enum BarStyle {
/**
 * In this mode, the title bar or toolbar is laid out above the content area.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    Standard
    | 
/**
 *  In this mode, the title bar or toolbar is overlaid on top of the content area.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    Stack
    | ...
}

extend BarStyle <: Equatable<BarStyle> {
/**
 * Compares this BarStyle with another for equality.
 * @param { BarStyle } other - The BarStyle to compare with.
 * @returns { Bool } True if both modes are equal, false otherwise.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public operator func ==(other: BarStyle): Bool
/**
 * Compares this BarStyle with another for equality.
 * @param { BarStyle } other - The BarStyle to compare with.
 * @returns { Bool } True if both modes are not equal, false otherwise.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public operator func !=(other: BarStyle): Bool
}

/**
 * Indicates the information of NavDestination.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public class NavPathInfo <: FFIData {
/**
 * Name of the navigation destination page.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var name: ?String

/**
 * Detailed parameters of the navigation destination page.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var param: ?String

/**
 * Callback returned when pop is called on the navigation destination page.
 * It is invoked only after the **result** parameter is set in pop.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public var onPop: ?Callback<PopInfo, Unit> = None

/**
 * Creates an instance of NavPathInfo.
 *
 * @param { ?String } name - The name of NavDestination.
 * @param { ?String } param - The detailed parameter of the NavDestination.
 * @param { ?Callback<PopInfo, Unit> } [onPop] - Callback returned when pop is called on the navigation destination page.
 * @returns { NavPathInfo }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public init(name!: ?String, param!: ?String, onPop!: ?Callback<PopInfo, Unit> = None)
}

/**
 * Indicates the information of NavDestinations. Providers methods for controlling destination page in the stack
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public class NavPathStack <: RemoteData {
/**
 * Creates an instance of NavPathStack.
 * @returns { NavPathStack }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public init()

/**
 * Pushes the navigation destination page specified by **info** onto the navigation stack.
 * Depending on the launchMode specified in the **options** parameter, different behaviors will be triggered.
 *
 * @param { ?NavPathInfo } info - Indicates the NavDestination to be pushed.
 * @param { ?NavigationOptions } [options] - Indicates options of stack operation.
 * @returns { Unit }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func pushPath(info: ?NavPathInfo, options!: ?NavigationOptions = None): Unit

/**
 * Pushes the specified NavDestination into the stack.
 *
 * @param { ?String } name - Indicates the name of the NavDestination to be pushed.
 * @param { ?String } param - Indicates the detailed parameter of the NavDestination to be pushed.
 * @param { ?Bool } [animated] - Indicates whether the transition is animated.
 *      Default value: true.
 *      true: The transition animation is supported. false: The transition animation is not supported.
 * @returns { Unit }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func pushPathByName(name: ?String, param: ?String, animated!: ?Bool = None)

/**
 * Pops the top NavDestination out of the stack.
 *
 * @param { ?Bool } [animated] - Indicates whether the transition is animated.
 * Default value: true.
 * true: The transition animation is supported. false: The transition animation is not supported.
 * @returns { ?NavPathInfo } Returns the top NavPathInfo if the stack is not empty, otherwise returns None.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func pop(animated!: ?Bool = None): ?NavPathInfo
}

/**
 * Defines Navigation Component.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
public class Navigation <: CommonMethodComponent<Navigation> & NavigationAttribute {
/**
 * Constructor of Navigation.
 *
 * @param { () -> Unit } [child] - The child component of Navigation.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public init(child!: () -> Unit = {=>})

/**
 * Constructor of Navigation.
 *
 * @param { ?NavPathStack } pathInfos - The stack of the route table.
 * @param { () -> Unit } [child] - The child component of Navigation.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public init(pathInfos: ?NavPathStack, child!: () -> Unit = {=>})

/**
 * Set builder for user-defined NavDestination component.
 *
 * @param { ?(String, Any) -> Unit } builder - The builder function of NavDestination component.
 * @returns { This } Returns the instance of the Navigation.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func navDestination(builder: ?(String, Any) -> Unit): This

/**
 * Navigation title.
 *
 * @param { ?ResourceStr } value - Navigation title.
 * @param { ?NavigationTitleOptions } [options] - Indicates the options of titlebar.
 * @returns { This }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func title(value: ?ResourceStr, options!: ?NavigationTitleOptions = None): This

/**
 * Navigation title.
 *
 * @param { ?CustomBuilder } value - Navigation title.
 * @param { ?NavigationTitleOptions } [options] - Indicates the options of titlebar.
 * @returns { This }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func title(value: ?CustomBuilder, options!: ?NavigationTitleOptions = None): This

/**
 * Sets whether to hide the title bar and whether to animate the visibility change.
 *
 * @param { ?Bool } hide - Whether to hide the title bar.
 *      Default value is false. true: Hide the title bar. false: Show the title bar.
 * @param { ?Bool } [animated] - Whether to animate the visibility change.
 *      Default value is false.
 *      true: Animate the visibility change. false: Do not animate the visibility change.
 * @returns { This }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    public func hideTitleBar(hide: ?Bool, animated!: ?Bool = None): This
}

/**
 * Declare Navigation view properties.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
sealed interface NavigationAttribute <: CommonMethod<NavigationAttribute> {
/**
 * Set builder for user-defined NavDestination component.
 *
 * @param { ?(String, Any) -> Unit } builder - The builder function of NavDestination component.
 * @returns { NavigationAttribute } Returns the instance of the Navigation.
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func navDestination(builder: ?(String, Any) -> Unit): NavigationAttribute

/**
 * Navigation title
 *
 * @param { ?ResourceStr } value - Navigation title.
 * @param { ?NavigationTitleOptions } options - Indicates the options of titlebar.
 * @returns { NavigationAttribute }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func title(value: ?ResourceStr, options!: ?NavigationTitleOptions): NavigationAttribute

/**
 * Navigation title
 *
 * @param { ?CustomBuilder } value - Navigation title.
 * @param { ?NavigationTitleOptions } options - Indicates the options of titlebar.
 * @returns { NavigationAttribute }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func title(value: ?CustomBuilder, options!: ?NavigationTitleOptions): NavigationAttribute

/**
 * Sets whether to hide the title bar and whether to animate the visibility change.
 *
 * @param { ?Bool } hide - Whether to hide the title bar.
 *      Default value is false.
 *      true: Hide the title bar. false: Show the title bar.
 * @param { ?Bool } animated - Whether to animate the visibility change.
 *      Default value is false.
 *      true: Animate the visibility change. false: Do not animate the visibility change.
 * @returns { NavigationAttribute }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func hideTitleBar(hide: ?Bool, animated!: ?Bool): NavigationAttribute
}

/**
 * The attribute function of NavDestination
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
sealed interface NavDestinationAttribute <: CommonMethod<NavDestinationAttribute> {
/**
 * Called when the navigation destination is about
 * to be unmounted (or when the transition animation, if any, is about to start).
 *
 * @param { ?() -> Bool } callback - Indicates callback when the backButton is pressed.
 * @returns { NavDestinationAttribute }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func onBackPressed(callback: ?() -> Bool): NavDestinationAttribute

/**
 * Called when the **NavDestination** component is about to build a child component.
 *
 * @param { ?Callback<NavDestinationContext, Unit> } callback
 * - Indicates callback that invoked before sub-components of NavDestination are created.
 * @returns { NavDestinationAttribute }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func onReady(callback: ?Callback<NavDestinationContext, Unit>): NavDestinationAttribute

/**
 * Sets the page title. When the NavigationCustomTitle type is used to set the height,
 * the titleMode attribute does not take effect.
 * When the title string is too long: (1) If no subtitle is set, the string is scaled down,
 * wrapped in two lines, and then clipped with an ellipsis (...); (2) If a subtitle is set,
 * the subtitle is scaled down and then clipped with an ellipsis (...).
 *
 * @param { ?ResourceStr } value - Defines the title.
 * @param { ?NavigationTitleOptions } options - Indicates the options of titlebar.
 * @returns { NavDestinationAttribute }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func title(value: ?ResourceStr, options!: ?NavigationTitleOptions): NavDestinationAttribute

/**
 * Sets the page title. When the NavigationCustomTitle type is used to set the height,
 * the titleMode attribute does not take effect.
 * When the title string is too long: (1) If no subtitle is set, the string is scaled down,
 * wrapped in two lines, and then clipped with an ellipsis (...); (2) If a subtitle is set,
 * the subtitle is scaled down and then clipped with an ellipsis (...).
 *
 * @param { ?CustomBuilder } value - Defines the title.
 * @param { ?NavigationTitleOptions } options - Indicates the options of titlebar.
 * @returns { NavDestinationAttribute }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func title(value: ?CustomBuilder, options!: ?NavigationTitleOptions): NavDestinationAttribute

/**
 * Specifies whether to hide the title bar.
 *
 * @param { ?Bool } value - Default value: false.
 *     true: Hide the title bar.
 *     false: Show the title bar.
 * @returns { NavDestinationAttribute }
 */
@!APILevel[
    since: "22",
    syscap: "SystemCapability.ArkUI.ArkUI.Full"
]
    func hideTitleBar(value: ?Bool): NavDestinationAttribute
}